package com.shrct.businessprocess.product.proxy;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.shrct.businessprocess.product.proxy.RCIdentifiableNormalProductEntryAction;

public class RCIdentifiableNormalProductEntryManager implements IsSerializable {
  public static Boolean isActionValid(final RCIdentifiableNormalProductEntryAction action, final String state) {
    if(action==null||state==null) return false;
    switch(action){
    	case _inStock:{
    		return "Created".equals(state);
    	}
    	case _deliver:{
    		return "InStocking".equals(state);
    	}
    	case _cancelInStock:{
    		return "InStocking".equals(state);
    	}
    	case _return:{
    		return "Delivered".equals(state);
    	}
    	default:
    		return false;
    }
    
  }
  
  public static Boolean isActionValid(final RCIdentifiableNormalProductEntryAction action, final Enum<?> state) {
    return isActionValid(action,state.name());
    
  }
}
